package com.cf.compent;

import java.util.concurrent.atomic.AtomicLong;

/**
 * game-server-RollPolingMachine
 *
 * @author <a href="2428922347@qq.com">Zhu mingming</a>
 * @info
 * @since 2018/5/11 下午 12:09
 */
public class RollPolingMachine {

    private int seed = 2;

    private AtomicLong atomicLong = new AtomicLong();

    public RollPolingMachine(int seed) {
        this.seed = seed;
    }

    public boolean ok() {
        long l = atomicLong.incrementAndGet();
        if (Long.MAX_VALUE == l) {
            atomicLong.set(0);
        }
        if (l % seed == 0) {
            return true;
        } else {
            return false;
        }
    }
}
